<?php
//forums index



function getLevel($level) {
	$levels = array(
		'administrator', 'board_mem', 'votes', 'volunteer', 'member', 'public'
	);
	$l = array_search($level, $levels);
	if ($l === false) {
		$l = 5;
	}
	return $l;
}

?>
<table id="forumTopic">
<tr><th>Forum Name</th><th>Most Recent Topic</th></tr>
<?php 
	foreach($forums as $forum) :
		if (getLevel($forum['Forum']['visibility']) >= getLevel($current_user['auth_type']) || (isset($current_user[$forum['Forum']['visibility']]) && $current_user[$forum['Forum']['visibility']])) :?>
<tr><td><?=$html->link($forum['Forum']['title'], '/forums/view/' . $forum['Forum']['id'])?></td><td>(none)</td></tr>
<?php
		endif;
	endforeach; ?>
</table>
<?php
pr($forums);
pr($current_user);
?>